import request from '@/config/axios'

// 记账企业开票信息 VO
export interface AccountingCompaniesInvoiceVO {
  id: number // 主键ID
  companyId: number // 记账企业ID
  invoiceName: string // 开票名称
  address: string // 地址
  bankName: string // 开户银行名称
  taxNumber: string // 纳税识别号
  phone: string // 电话
  bankAccount: string // 开户银行账号
  infoType: number // 信息类型：1-开票信息，2-收款信息
  createTime: string // 创建时间
}

// 记账企业开票信息 API
export const AccountingCompaniesInvoiceApi = {
  // 创建记账企业开票信息
  createAccountingCompaniesInvoice: async (data: AccountingCompaniesInvoiceVO) => {
    return await request.post({ url: `/oa/accounting-companies-invoice/create`, data })
  },

  // 更新记账企业开票信息
  updateAccountingCompaniesInvoice: async (data: AccountingCompaniesInvoiceVO) => {
    return await request.put({ url: `/oa/accounting-companies-invoice/update`, data })
  },

  // 创建或更新记账企业开票信息
  createOrUpdateAccountingCompaniesInvoice: async (data: AccountingCompaniesInvoiceVO) => {
    return await request.post({ url: `/oa/accounting-companies-invoice/create-or-update`, data })
  },

  // 删除记账企业开票信息
  deleteAccountingCompaniesInvoice: async (id: number) => {
    return await request.delete({ url: `/oa/accounting-companies-invoice/delete?id=` + id })
  },

  // 获得记账企业开票信息
  getAccountingCompaniesInvoice: async (id: number) => {
    return await request.get({ url: `/oa/accounting-companies-invoice/get?id=` + id })
  },

  // 获得记账企业开票信息列表
  getAccountingCompaniesInvoiceListByCompanyId: async (companyId: number) => {
    return await request.get({ url: `/oa/accounting-companies-invoice/list-by-company-id?companyId=` + companyId })
  },

  // 根据企业ID和信息类型获得信息列表
  getAccountingCompaniesInvoiceListByCompanyIdAndType: async (companyId: number, infoType: number) => {
    return await request.get({ url: `/oa/accounting-companies-invoice/list-by-company-id-and-type?companyId=${companyId}&infoType=${infoType}` })
  }
} 